package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    List<Student> list(StudentQueryParam studentQueryParam);

    void deleteById(List<Integer> ids);

    @Insert("insert into student(name,no,gender,phone,id_card,address,is_college,degree,graduation_date,clazz_id,create_time,update_time) values" +
            "(#{name},#{no},#{gender},#{phone},#{idCard},#{address},#{isCollege},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")
    void add(Student student);

    @Select("select * from student where id = #{id}")
    Student get(Integer id);

    void update(Student student);


    void violation(Integer id, Integer score);

    @MapKey("name")
    List<Map<String, Object>> countStudentDegreeData();

    @MapKey("name")
    List<Map<String, Object>> countStudentData();
}
